<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace App\Common\Dao\System;

use App\Common\Dao\BaseDao;
use App\Model\CustomerJobs;

class CustomerJobsDao extends BaseDao
{
    public function search(array $where)
    {
        return CustomerJobs::when(isset($where['status']) && $where['status'] != '', function ($query) use ($where) {
            $query->where('status', $where['status']);
        })
            ->when(isset($where['job_name']) && $where['job_name'] != '', function ($query) use ($where) {
                $query->where('job_name', 'like', '%' . $where['job_name'] . '%');
            });
    }

    protected function getModel(): CustomerJobs
    {
        return new CustomerJobs();
    }
}
